export default {
	getAdData(store, json) {
		return new Promise((resolve, reject) => {
			store.dispatch('requestData', {
				path: "/getAdData",
				data: json
			}).then(res => {
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	},
	getLocalData(store, json) {
		return new Promise((resolve, reject) => {
			store.dispatch('requestData', {
				path: "/getLocalData/index",
				data: json
			}).then(res => {
				store.commit('saveToState', {
					type:"localData",
					data: res.data
				})
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	},
	getLocalChannels(store, json){
		return new Promise((resolve, reject) => {
			store.dispatch('requestData', {
				path: "/getLocalData/channel",
				data: json
			}).then(res => {
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	},
	getChannelListData(store, json){
		return new Promise((resolve, reject) => {
			store.dispatch('requestData', {
				path: "/getLocalData/channel/list",
				data: json
			}).then(res => {
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	},
	getMoreLocalData(store, json) {
		return new Promise((resolve, reject) => {
			store.dispatch('requestData', {
				path: "/getMoreLocalData",
				data: json
			}).then(res => {
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	},
	getRecommendData(store, json) {
		return new Promise((resolve, reject) => {
			store.dispatch('requestData', {
				path: "/getRecommendData/index",
				data: json
			}).then(res => {
				store.commit('saveToState', {
					type:"recommendData",
					data: res.data
				})
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	},
	getMoreRecommendData(store, json) {
		return new Promise((resolve, reject) => {
			store.dispatch('requestData', {
				path: "/getMoreRecommendData",
				data: json
			}).then(res => {
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	},
	getNewsDetail(store, json){
		return new Promise((resolve, reject) => {
			store.dispatch('requestData', {
				path:"/getNewsDetail",
				data: json
			}).then(res => {
				resolve(res)
			}).catch(err => {
				reject(err)
			})
		})
	}
}
